home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / AMSrv_0_9.lha / AMSrv / Doc / MUDAgent.txt < prev    next >
Text File  |  1995-01-21  |  22KB  |  479 lines

  1. AmigaMUD, Copyright 1995 by Chris Gray
  2.  
  3.  
  4.             The MUDAgent Program
  5.  
  6. The MUDAgent program is only needed on a host machine (one running
  7. MUDServ, the AmigaMUD server program) which wants to allow serial port
  8. connections to remote players. One running copy of MUDAgent is needed
  9. for each serial port connection. MUDAgent serves as a "protocol
  10. converter" in that it uses the AmigaMUD reliable protocol over the
  11. serial port and uses simple Amiga OS messages to and from MUDServ.
  12.  
  13. MUDAgent can be used in a number of ways:
  14.  
  15.     - by default, MUDAgent will open a serial port and wait for
  16.     connections on that port. Each connection is treated as a
  17.     request to play one AmigaMUD session. When the session is
  18.     over, MUDAgent will go back to waiting for a connection. If
  19.     MUDAgent is started from a shell in this mode, then it can
  20.     be shut down by sending a BREAK signal to its CLI number. If
  21.     it is started from the Workbench, then the AgentKill program
  22.     can be used to shut it down. In this mode of operation, the
  23.     running MUDAgent program is considered to be an active client
  24.     by the MUDServ program, and MUDServ will not exit until the
  25.     MUDAgent has gone away.
  26.  
  27.     - MUDAgent can be started up by another program which has already
  28.     established a connection and setup the serial port. In this
  29.     mode, MUDAgent will open the serial port for shared use, and
  30.     will exit after a single AmigaMUD session completes.
  31.  
  32.     - MUDAgent communicates with a remote copy of "MUD" using a
  33.     special protocol. This allows reliable handling of graphics
  34.     output, mouse input, function editing, etc. MUDAgent can work
  35.     with a simple remote terminal (or terminal emulator), however,
  36.     by operating in a text-only mode. This mode is detectable by
  37.     the scenario, so it can change its behaviour accordingly.
  38.  
  39. MUDAgent can be run from either the Workbench or from a shell command
  40. line. When started by another program (such as "Getty" or a BBS), it
  41. expects to be started as if from a shell command line.
  42.  
  43. MUDAgent requires a stack of at least 10000 bytes. It will exit right
  44. away if it detects an insufficient stack. The large stack is needed
  45. because of the possibility that, when running in text-only mode, a
  46. remote wizard may cause functions to be parsed using the recursive
  47. descent parser in "mud.library". See file "Programming.txt" for more
  48. information on this and other wizard-mode features.
  49.  
  50. MUDAgent supports Christopher Wichura's OwnDevUnit library. When not
  51. started with the '-Getty' flag, it will attempt to open that library
  52. and lock the serial port. It will wait indefinitely for that lock.
  53. Once it has the port locked, MUDAgent will accept a release request
  54. from OwnDevUnit.library, and will close and release the port. It will
  55. then request the port again, ready for when the other user releases
  56. it. If your system does not use OwnDevUnit.library, then this
  57. paragraph does not apply and can be ignored.
  58.  
  59.  
  60. Workbench ToolTypes Understood by MUDAgent
  61.  
  62. 'bool' values are those which can have one of two different values.
  63. The accepted values for a positive value are 'YES', 'Y', 'ON', 'TRUE',
  64. 'Y' and 'T'. Any other value is interpreted as a negative value. If
  65. no value is given it is interpreted as a positive value. Note that
  66. early version of the AmigaOS will not accept empty values.
  67.  
  68.     DEVICE (string) - specifies the name of the serial device to open.
  69.     The default name is "serial.device", which refers to the
  70.     standard built-in serial port. Other names are used with
  71.     expansion serial ports. (Do not include the quotation marks.)
  72.  
  73.     UNIT (number) - specifies the number of the port within a given
  74.     serial device of the particular port to use. This defaults to
  75.     0, indicating the "first" port.
  76.  
  77.     BAUD (number) - specifies the connection speed to use. The default
  78.     value is whatever speed the serial port was last used at,
  79.     which is normally the preferences speed. A later section gives
  80.     more details on connection speed selection.
  81.  
  82.     SHARED (boolean) - under the Amiga OS, a serial port can be opened
  83.     in "shared" mode. This means that more than one program can
  84.     have the port open at the same time. This can lead to great
  85.     confusion unless the programs cooperate. MUDAgent assumes that
  86.     if SHARED is specified, the calling program will not try to
  87.     use the port until MUDAgent has exited. If SHARED is not
  88.     specified, MUDAgent cannot open the port if some other program
  89.     already has it open. The other program must also have the port
  90.     opened for shared use.
  91.  
  92.     XONXOFF (boolean) - this tooltype causes MUDAgent to open the
  93.     serial port with Xon/Xoff software flow control enabled. This
  94.     is only relevant for a text-only connection, since in a full
  95.     binary connection the flow control characters can be part of
  96.     messages and hence cannot be treated specially. By default,
  97.     MUDAgent will not enable this feature.
  98.  
  99.     IGNORECD (boolean) - this tooltype causes MUDAgent to setup the
  100.     serial port to ignore the CD (Carrier Detect) signal. By
  101.     default, MUDAgent will assume that if the signal is not
  102.     present there is no connection, and will terminate the
  103.     session. You will need to supply this flag if your modem is
  104.     not configured to supply the signal, or if your serial cable
  105.     does not properly transmit the signal. Also, when connecting
  106.     directly to another computer or to a terminal, without a modem
  107.     in between, no CD signal will be present, so this flag should
  108.     be given. By default, MUDAgent will respect the CD signal.
  109.  
  110.     7WIRE (boolean) - this tooltype tells MUDAgent to setup the serial
  111.     port using a 7-wire hardware flow-control system. Such a
  112.     system is recommended when using a high-speed connection,
  113.     since it allows either end of the serial cable to tell the
  114.     other end to temporarily stop transmitting. Compression and
  115.     error-recovery protocols on newer modems may require this type
  116.     of signalling. You should NOT specify this mode if your modem
  117.     is not configured to pay attention to it, or if your serial
  118.     cable does not transmit all of the required signals. By
  119.     default, MUDAgent will not enable 7-wire flow control.
  120.  
  121.     AT (boolean) - by default, MUDAgent will assume that there is a
  122.     "Hayes-compatible" modem on the serial port, and will send an
  123.     "AT\r" sequence to get it in synchronization. This can be
  124.     disabled using the AT tooltype.
  125.  
  126.     BINARY (boolean) - this tooltype forces MUDAgent to look for a
  127.     full binary connection (as opposed to a text-only connection)
  128.     on the serial port. It will not recognize a text-only
  129.     connection. Forcing the type of connection must be done when
  130.     MUDAgent is started up from another program, and can also be
  131.     done under other types of startup.
  132.  
  133.     TEXT (boolean) - this tooltype forces MUDAgent to only look for a
  134.     text-only connection on the serial port. It will not attempt
  135.     to make a full binary connection.
  136.  
  137.     PARITY={NONE|EVEN|ODD} - this tooltype can be used to specify the
  138.     parity of the serial connection. Parity other than 'NONE'
  139.     cannot be used for a binary connection. By default, MUDAgent
  140.     will use 'NONE' parity.
  141.  
  142.     RETRY (number) - this tooltype allows you to specify the number of
  143.     seconds that MUDAgent is to delay between its attempts to open
  144.     the serial port. This facility allows MUDAgent to be started
  145.     when the serial port is already in use, without using a
  146.     locking mechanism. (Support for locking mechanisms is planned,
  147.     but not yet implemented.) The default value is 60 seconds.
  148.  
  149.     PROBE (number) - this tooltype specifies in seconds the delay
  150.     between probes of the opened serial device, looking for a
  151.     carrier detect signal (if IGNORECD is specified, the first
  152.     such probe will report a connection). The default value is 3
  153.     seconds.
  154.  
  155.     DISCONNECT (number) - this tooltype specifies in seconds the delay
  156.     between the ending of a session and when MUDAgent will close
  157.     the serial port (thus dropping the connection in most cases).
  158.     This delay allows characters to be flushed out, and prevents
  159.     possible disconnection noise for the given interval. The
  160.     default value is 3 seconds.
  161.  
  162.     TIMEOUT (number) - this tooltype specifies in seconds the
  163.     inactivity timeout value. If no characters are received on the
  164.     serial port for this period, MUDAgent will assume that the
  165.     other end has gone away, and will terminate the connection.
  166.     The default value is 15 * 60 seconds, or 15 minutes.
  167.  
  168.     RETRYLIMIT (number) - when operating in binary mode, line noise or
  169.     other errors can cause a message to be incorrectly received.
  170.     When this happens, the AmigaMUD protocol will try again to
  171.     send the same message, and will keep doing so until the
  172.     message is properly acknowledged by the receiving end, or
  173.     until this number of attempts have been made. In the latter
  174.     case, MUDAgent will assume that the other end has gone away,
  175.     and will terminate the session.
  176.  
  177.     REQUESTLIMIT (number) - the number of AmigaMUD messages that go
  178.     back and forth between the server and the remote client is not
  179.     possible to predict, and the counts can vary widely between
  180.     the two directions. Because of this, MUDAgent may build up an
  181.     accumulation of unused messages. This accumulation should be
  182.     limited, to prevent unreasonably large amounts of memory from
  183.     being tied up. This tooltype specifies the number of such
  184.     messages that MUDAgent can keep around. The default value is
  185.     10.
  186.  
  187.     TEST - by default, MUDAgent will look for an Amiga OS message port
  188.     called "MUD port" by which to contact MUDServ. If this
  189.     tooltype is given, then MUDAgent will use name "MUD test port"
  190.     instead. This is a handy way of having more than one AmigaMUD
  191.     running on a given Amiga.
  192.  
  193.     PORTNAME (string) - this tooltype is a more general form of the
  194.     TEST tooltype. It allows a specific Amiga OS message port name
  195.     to be given for the connection to MUDServ.
  196.  
  197.     FLAGS (number) - this flags value is passed through to the code in
  198.     "mud.library" when a text-only connection is made. In binary
  199.     connections, the flags are passed to the copy of the library
  200.     running on the remote machine by the "MUD" program. The flags
  201.     only affect wizards, and relate to some caching that can be
  202.     done by the library code. The value, which defaults to 0, is
  203.     the sum of the following two values:
  204.  
  205.         1 - cache procs
  206.         2 - cache symbols
  207.  
  208.     Both are of benefit only when a wizard will be doing a lot of
  209.     parsing of AmigaMUD code. They cut down on the number of
  210.     messages between MUDAgent and MUDServ when parsing code, at
  211.     the expense of increased memory usage.
  212.  
  213.  
  214. Command Line Arguments
  215.  
  216. If a command line argument does not have a leading '-', then it is
  217. parsed as a tooltype value, as described in the previous section. The
  218. first six command line flags described here are for use by the "Getty"
  219. program and for callouts by BBS's, etc. Most of the other flags are
  220. equivalent to a tooltype value. See those descriptions for more
  221. details.
  222.  
  223.     -Getty - this flag tells MUDAgent that the serial port is already
  224.     opened and set up. MUDAgent will open it in shared mode and
  225.     will not do any initialization on it. Also, it will not send
  226.     any "AT\r" sequence, and it will exit after one AmigaMUD
  227.     session.
  228.  
  229.     -DEVICE <name> - <name> is the name of the serial device to use.
  230.     The default name is "serial.device". Other names are used to
  231.     specify ports on expansion boards.
  232.  
  233.     -UNIT <unit> - <unit> is the number of the particular port on a
  234.     serial port device to use. The default is 0.
  235.  
  236.     -HLINK - this flag is equivalent to the IGNORECD=TRUE tooltype.
  237.  
  238.     -BAUD <speed> - <speed> is the speed of the connection. The
  239.     default is the preferences set speed, although this value is
  240.     not actually used when the "-Getty" flag is given.
  241.  
  242.     -USER <name> - this flag, given by newer versions of "Getty", is
  243.     ignored by MUDAgent.
  244.  
  245.     -d<name> - this is the normal flag for specifying the name of the
  246.     device to use for the serial connection. The default name is
  247.     "serial.device".
  248.  
  249.     -u<unit> - this is the normal flag for specifying the unit number
  250.     within a device of the port to use. The default is port 0.
  251.  
  252.     -b<speed> - this is the normal flag to use to specify the speed of
  253.     the connection.
  254.  
  255.     -s - this flag specifies that the port should be opened in shared
  256.     mode.
  257.  
  258.     -x - enable XON/XOFF flow control (only in text-only mode)
  259.  
  260.     -i - ignore CD (Carrier Detect)
  261.  
  262.     -7 - use 7-wire hardware flow control
  263.  
  264.     -a - do not send 'AT' sequence to force rate on modem
  265.  
  266.     -p{n|e|o} - set parity. Must be 'n' for binary connection. The
  267.     default is -pn (no parity).
  268.  
  269.     -t{r|p|d|t}<value> - set a timeout value:
  270.     -tr - retry delay between attempts to open serial port. (default
  271.         60 seconds)
  272.     -tp - probe delay between probes for a carrier after the port
  273.         is open (default 3 seconds)
  274.     -td - disconnect delay before device close. (default 3 secs)
  275.     -tt - inactivity timeout before disconnect. (default 15 * 60
  276.         or 15 minutes)
  277.  
  278.     -h - (hardwired) - this is an abbreviation for "-a -td1"
  279.  
  280.     -T - use "MUD test port" as the Amiga OS port name
  281.  
  282.     -P<name> - use <name> as the Amiga OS port name. The default name
  283.     is "MUD port".
  284.  
  285.     -f<value> - set flags value. The flags value, (default 0) is the
  286.     sum of:
  287.         1 - cache procs
  288.         2 - cache symbols
  289.     Non-zero values are only of use when a text-only connection is
  290.     made, and the remote user is a wizard who will be doing a lot
  291.     of parsing of AmigaMUD code. In that case, enabling these
  292.     caches can greatly reduce the message traffic between MUDAgent
  293.     and MUDServ, at the expense of increased memory usage.
  294.  
  295.     -r<value> - the given value is the number of times MUDAgent will
  296.     attempt to send a given message over the serial port. Retries
  297.     are needed when line noise or lost data prevent a message from
  298.     reaching the receiver intact. If a given message cannot be
  299.     sent after this number of attempts, then MUDAgent will give up
  300.     on the connection and close it down. The default value is 10.
  301.     This is only relevant for binary connections.
  302.  
  303.     -R<value> - set free request limit (default 10)
  304.  
  305.     -N <name> - use <name> as the name of the character for the the
  306.     first playing session, rather than prompting for a name. Note
  307.     that this option only makes sense for a text-only connection.
  308.     On a full binary connection, the corresponding flags can be
  309.     given on the remote MUD run.
  310.  
  311.     -W <word> - use <word> as the password for the first playing
  312.     session. If it is incorrect, it counts as the first attempt,
  313.     and only two attempts remain. This is normally used in
  314.     conjunction with -N, but can be used without it. This flag
  315.     also is only relevant for a text-only connection.
  316.  
  317.  
  318. Line Speed and Mode Selection
  319.  
  320. When MUDAgent is started by another program which already has the
  321. serial port set up (the "-Getty" flag is given), then MUDAgent will
  322. not do any serial port initialization, and will not try to change the
  323. connection speed. Thus, the presence of "-Getty" makes BAUD, IGNORECD,
  324. 7WIRE, PARITY, RETRY, PROBE, DISCONNECT and XONXOFF meaningless. It
  325. also forces SHARED and AT=FALSE. TEXT, BINARY, RETRYLIMIT,
  326. REQUESTLIMIT and FLAGS are still meaningful. With this type of
  327. startup, the type of connection (TEXT or BINARY) must be specified.
  328.  
  329. The following paragraphs discuss speed and mode selection when
  330. MUDAgent is not started by another program.
  331.  
  332. In most cases, MUDAgent will be used with a high-speed modem, and the
  333. connection between the modem and MUDAgent will be at a fixed rate,
  334. such as 19200 bps, regardless of the actual modem connection speed.
  335. The modem converts between the fixed serial port speed and the varying
  336. data speed as required. The type of connection can either be forced
  337. using TEXT or BINARY, or can be chosen dynamically, based on the first
  338. valid characters received. If the first two characters are ASCII SYN
  339. characters, then a binary connection is assumed. If the character
  340. received is a carriage return, in either no parity or even parity,
  341. then a text-only connection with that parity is assumed.
  342.  
  343. Older, slower modems do not do this speed conversion, so the correct
  344. speed must be given explicitly, and must match the actual connection
  345. speed. If, however, a speed of 0 is specified, then MUDAgent will
  346. cycle through the 2400, 1200 and 300 bps speeds, looking for an ASCII
  347. SYN character or a carriage return.
  348.  
  349. If possible, an explicit TEXT or BINARY should be given, so that
  350. MUDAgent does not have to do the possibly unreliable autodetection of
  351. the mode.
  352.  
  353.  
  354. Text-Only Line Editing
  355.  
  356. When a text-only connection is in effect, MUDAgent keeps user input
  357. and asynchronous output on separate lines. It does this by holding
  358. back output lines if the user has typed a partial input line. If the
  359. number of held-back lines reaches 10, then MUDAgent will erase the
  360. partial input line and prompt, display all held-back output lines,
  361. then redisplay the prompt and partial input line. If any lines are
  362. held back when the line is ended or is fully erased, then the prompt
  363. is erased, the held-back lines are printed, and the prompt is
  364. redisplayed. The normal situation is that there is no partial input
  365. line, and just the prompt is displayed. In this case, when output
  366. lines arrive, the prompt is cleared, the output lines are immediately
  367. displayed, and then the prompt is redisplayed.
  368.  
  369. MUDAgent supports a small set of input-editing features when a text-
  370. only connection is in effect. The special characters handled are:
  371.  
  372.     - carriage return (\r) or newline (\n) - these characters signal
  373.     the end of the input line. The current input line is sent to
  374.     the server (or parsed if in wizard mode). If any output lines
  375.     are held back, they are then displayed. Finally, a new prompt
  376.     is displayed. Input lines are entered into an input history
  377.     buffer, from which they can be retrieved.
  378.  
  379.     - backspace (\b) - if there are any characters in the current
  380.     input line, then the rightmost one is erased (using a
  381.     backspace-space-backspace sequence). If this results in the
  382.     input line being empty, then any held-back lines are flushed.
  383.  
  384.     - control-W - this character causes MUDAgent to erase the previous
  385.     "word" of input, in the same way that the standard Amiga shell
  386.     does, or the MUD client does.
  387.  
  388.     - control-X, control-C or control-U - any of these characters will
  389.     empty the current input line, and, if needed, allow any held-
  390.     back output lines to be flushed.
  391.  
  392.     - control-R - this character causes MUDAgent to redraw the current
  393.     input line. This is useful if line noise has garbled the
  394.     display. A '^R' is displayed at the end of the input line, and
  395.     it is redrawn on the next line.
  396.  
  397.     - control-\ or control-D - these characters (the AmigaDOS and more
  398.     standard end-of-file characters) indicate an end-of-input to
  399.     MUDAgent. It will output a carriage-return/linefeed sequence
  400.     and then initiate termination of the current session.
  401.  
  402.     - control-P - this character retrieves the previous line of input
  403.     history. Any current input line is erased, and the previous
  404.     input line is redisplayed. Multiple control-P's can go back
  405.     further in the input history. Input lines retrieved from
  406.     history can be edited just like input lines typed by the user.
  407.     Lines retrieved and used unchanged from history are not re-
  408.     entered into the input history.
  409.  
  410.     - control-N - this character retrieves the next line of input
  411.     history, undoing the effect of a control-P. Sequences of
  412.     control-P's and control-N's can be used to view the entire
  413.     input history (limited to 1024 characters).
  414.  
  415. Other non-printable characters are simply discarded. Characters with
  416. the high bit set (only possible with a no-parity connection) are not
  417. accepted.
  418.  
  419.  
  420. Examples
  421.  
  422. If MUDAgent is run with all default settings, it will open the built-
  423. in serial port at whatever speed it is currently at, and wait for
  424. text-only or binary connections. It will only exit when a BREAK signal
  425. is sent to it.
  426.  
  427. If a BBS or Getty is running, and will be used to startup MUDAgent,
  428. then there will normally be BBS commands or Getty logins which will
  429. start it in the text-only and the full binary modes. I use Getty
  430. logins 'mudt' and 'mudb' for those purposes. Appropriate entries in
  431. the "Passwd" file are something like this:
  432.  
  433.     mudt,,207,1,(MUD-TEXT),AmigaMUD:,AmigaMUD:C/MUDAgent -7 text
  434.     mudb,,207,2,(MUD-BINARY),AmigaMUD:,AmigaMUD:C/MUDAgent -7 binary
  435.  
  436. This assumes that the system has a volume or assign named "AmigaMUD"
  437. and that a "C" directory in that location contains the various
  438. AmigaMUD programs. Equivalent commands for a BBS callout might be:
  439.  
  440.     AmigaMUD:C/MUDAgent -Getty -DEVICE $device -UNIT $unit text
  441.     AmigaMUD:C/MUDAgent -Getty -DEVICE $device -UNIT $unit binary
  442.  
  443. where '$device' is replaced by the name of the serial device the
  444. caller is on, and '$unit' is replaced by it's unit number. For the
  445. built-in port, a binary connection would then be:
  446.  
  447.     AmigaMUD:C/MUDAgent -Getty -DEVICE serial.device -UNIT 0 binary
  448.  
  449. If no BBS is being run, and Getty is not being used, then MUDAgent can
  450. be told to answer incoming calls at the current speed with:
  451.  
  452.     run AmigaMUD:C/MUDAgent
  453.  
  454. from a shell or by double-clicking on its icon with no tooltypes
  455. specified.
  456.  
  457. If an older, low-speed modem is used on device siosbx.device, unit 1,
  458. and auto-detection of line speed is desired, then the shell command:
  459.  
  460.     run AmigaMUD:C/MUDAgent -dsiosbx.device -u1 -b0
  461.  
  462. could be used. If the modem does not understand the "AT" commands,
  463. does not generate a proper carrier detect signal, but does properly do
  464. hardware handshaking, then the following set of icon tooltypes could
  465. be used for an appropriate Workbench startup:
  466.  
  467.     DEVICE=siosbx.device
  468.     UNIT=1
  469.     BAUD=0
  470.     AT=OFF
  471.     IGNORECD=TRUE
  472.     7WIRE=TRUE
  473.  
  474. Many other possibilities exist. Most users will not need to change the
  475. values of RETRY, PROBE, DISCONNECT, TIMEOUT, RETRYLIMIT, REQUESTLIMIT
  476. or PORT. Increasing RETRYLIMIT can help compensate for noisy binary
  477. connections, but the user will have to do the same with the MUD client
  478. program.
  479.